
/**
 房间运营状态
 *
*/

import { StationNetwork } from "GameLoop/Path/StationNetwork";
import { State } from "framework/FSM/AState";
 
import { priority } from "utils/constants/definetypes";
 
import { BaseMinerial, ZipMinerial } from "utils/constants/globalconstant";
import { spawnPriority } from "utils/constants/priorityconstant";
import { TaskHelper } from "utils/task/TaskHelper";

/**
 * 运输网络决策.
 * 通过计算外矿到房间中心的距离。计算需要多少个carry。然后发布任务并且限制被共享的次数。
 * 没有任务的运输爬自己领取最近的任务。去资源点等待资源.
 */

interface ITaskExecute<T> 
{
    (arg:T,Task:any):void
}
export class BaseState<T extends IStateArg<Room >> extends State<T>
{
    private TaskMap:Record<TaskType,ITaskExecute<T>>={
        // KeepCreep:this.CreepKeep.bind(this)
        // KeepCreep:this.pushSpawnTask.bind(this)
    } as  any;
    public getActions(arg:T):Action[]
    {
        if(arg.entity.controller?.level as number>=5)
        {
            if(arg.entity.canExecute(7))
            {
                arg.entity.linkTransferEnergy();
            }
        }
        const ps = arg.entity.getEntity("CoreEntity").PowerSpawn;
        if(ps && ps.store.getUsedCapacity(RESOURCE_ENERGY)>0&& ps.store.getUsedCapacity(RESOURCE_POWER)>0)
        {
            ps.processPower();
        }
        // const nodememory = arg.entity.getNodeMemory();
       
        // 房间爬虫绑定
        // 返回的Action为一组可以立即执行的Action命令参数
        return [];
    } 
}
